package com.leoman.customer.dao;

import com.leoman.common.dao.IBaseJpaRepository;
import com.leoman.customer.entity.Customer;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by Daisy on 2016/12/27.
 */
public interface CustomerDao extends IBaseJpaRepository<Customer> {

    @Query("select a from Customer a where a.status = 0 and a.adminId = ?1")
    public List<Customer> findByAdminId(Long adminId);

    @Query("select a from Customer a where a.status = 0 and a.demandNo = ?1")
    public Customer findByDemandNo(String demandNo);

    @Query("select a from Customer a where a.status = 0 and a.demandNo = ?1 and a.id != ?2")
    public Customer findByDemandNoAndId(String demandNo, Long id);

}
